#include "timemanager.h"

TimeManager::TimeManager(QObject *parent) : QObject(parent),m_time(0)
{
    m_timer = new QTimer(this);
    connect(m_timer, &QTimer::timeout, this, &TimeManager::updateTime);
    m_timer->start(1000);
}

bool TimeManager::isTime() const
{
    return m_time < DAY_LENGTH;
}

void TimeManager::updateTime()
{
    m_time = (m_time + 1) % (DAY_LENGTH + NIGHT_LENGTH);
    emit timeChange();
}
